package com.example.demo;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/waybill")
public class WaybillController {

    @GetMapping("/get")
    public ResponseEntity<Map<String, Object>> getWaybillData() {
        Map<String, Object> waybillData = new HashMap<>();

        // 模拟的快递单数据，实际数据可以从数据库或者其他服务中获取
        waybillData.put("waybillCode", "3738460008834");
        waybillData.put("recipient", Map.of(
                "name", "张三",
                "mobile", "17313857698",
                "address", Map.of(
                        "province", "湖南省",
                        "city", "长沙市",
                        "district", "岳麓区",
                        "detail", "路淞虹路66666号"
                )
        ));
        waybillData.put("sender", Map.of(
                "name", "张无忌",
                "mobile", "18516580554",
                "address", Map.of(
                        "province", "上海市",
                        "city", "上海市",
                        "district", "黄浦区",
                        "detail", "上海物资大厦20楼"
                )
        ));

        return ResponseEntity.ok(waybillData);
    }
}
